@[] directive

The @[x] directive is like the inverse of the @quote directive. It outputs the result of macro expanding the result of macro expanding x (i.e. macro expansions are applied twice). It follows that @[@quote(y)] is equivalent to y.

In the example below, the expression v@@1 has managed to defeat the macro expander (i.e. preventing invocation of v1), but the @[] directive is able to force the macro substitution to take place anyway.

Before translationAfter translation
@def v1 = 3
const char* f()
{
    return @str(v@@1 = @[v@@1]);
}


const char* f()
{
    return "v1 = 3";
}

Another example:

Before translationAfter translation
@def min(x,y) =
{
    @if (x < y) {x}
    @else       {y}
}
@def x1 = 10
@def x2 = 20
int f()
{
    return @[x@@min(1,2)];
}








int f()
{
    return 10;
}